using GalaSoft.MvvmLight;

namespace Opds_Viewer.ViewModel
{
    /// <summary>
    /// This class contains static references to all the view models in the
    /// application and provides an entry point for the bindings.
    /// </summary>
    public class ViewModelLocator
    {
        private static MainViewModel _main;
        private static AboutViewModel _about;
        private static CatalogViewModel _catalog;
        private static DownloadViewModel _download;
        private static HomeViewModel _home;
        private static InitViewModel _init;
        private static ParameterViewModel _parameter;
        
        /// <summary>
        /// Gets the Main property which defines the main viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
            "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public MainViewModel Main
        {
            get { return _main ?? (_main = new MainViewModel()); }
        }

        /// <summary>
        /// Gets the About property which defines the about viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public AboutViewModel About
        {
            get { return _about ?? (_about = new AboutViewModel()); }
        }

        /// <summary>
        /// Gets the Home property which defines the home viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public HomeViewModel Home
        {
            get { return _home ?? (_home = new HomeViewModel()); }
        }

        /// <summary>
        /// Gets the Init property which defines the init viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public InitViewModel Init
        {
            get { return _init ?? (_init = new InitViewModel()); }
        }

        /// <summary>
        /// Gets the Catalog property which defines the catalog viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public CatalogViewModel Catalog
        {
            get { return _catalog ?? (_catalog = new CatalogViewModel()); }
        }

        /// <summary>
        /// Gets the Download property which defines the download viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public DownloadViewModel Download
        {
            get { return _download ?? (_download = new DownloadViewModel()); }
        }

        /// <summary>
        /// Gets the Parameter property which defines the parameter viewmodel.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public ParameterViewModel Parameter
        {
            get { return _parameter ?? (_parameter = new ParameterViewModel()); }
        }
    }
}